//
//  ChildrenStoryCollectCell.m
//  HappyBaby
//
//  Created by 华哥 on 15/11/24.
//  Copyright © 2015年 华哥. All rights reserved.
//

#import "ChildrenStoryCollectCell.h"

@interface ChildrenStoryCollectCell ()


@end

@implementation ChildrenStoryCollectCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.typeLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.bounds.origin.x - 1, self.bounds.origin.y - 1, self.bounds.size.width - 2, self.bounds.size.height - 2)];
        self.typeLabel.textAlignment = NSTextAlignmentCenter;
        self.typeLabel.font = [UIFont systemFontOfSize:10 weight:0.5];
        
//        self.typeLabel.clipsToBounds = YES;
        self.typeLabel.layer.cornerRadius = 6;
        self.typeLabel.layer.masksToBounds = YES;
        self.typeLabel.backgroundColor = [UIColor whiteColor];
        UIColor *color1 = [UIColor colorWithRed:147 / 255.0 green:207 / 255.0 blue:25 / 255.0 alpha:1];
        UIColor *color2 = [UIColor colorWithRed:133 / 255.0 green:61 / 255.0 blue:173 / 255.0 alpha:1];
        UIColor *color3 = [UIColor colorWithRed:245 / 255.0 green:185 / 255.0 blue:9 / 255.0 alpha:1];
        UIColor *color4 = [UIColor colorWithRed:212 / 255.0 green:58 / 255.0 blue:108 / 255.0 alpha:1];
        UIColor *color5 = [UIColor colorWithRed:245 / 255.0 green:152 / 255.0 blue:51 / 255.0 alpha:1];
        UIColor *color6 = [UIColor colorWithRed:60 / 255.0 green:178 / 255.0 blue:255 / 255.0 alpha:1];
        NSArray *colorArray = @[color1, color2, color3, color4, color5, color6];
        int colorNumber = arc4random() % 6;
        self.typeLabel.textColor = colorArray[colorNumber];
        [self.contentView addSubview:_typeLabel];
    }
    return self;
}

- (void)setChildrenStoryListModel:(ChildrenStoryList *)childrenStoryListModel
{
    _childrenStoryListModel = childrenStoryListModel;
    self.typeLabel.text = childrenStoryListModel.name;
//     self.typeLabel.font = [UIFont fontWithName:@"ArialRounded" size:6];
//    self.typeLabel.font = [UIFont systemFontOfSize:8 weight:0.5];
}



@end
